#!node
var gulp=require('gulp'),
		wrap=require('gulp-wrap'),
		usemin=require('gulp-usemin'),
		uglify=require('gulp-uglify'),
		less=require('gulp-less'),
		minifyHtml=require('gulp-minify-html'),
		minifyCss=require('gulp-minify-css');

gulp.task('ui',function(){
	return gulp.src('src/ui.*')
		.pipe(gulp.dest('dist/'));
});

gulp.task('default',['ui'],function(){
	return gulp.src('src/*.html')
		.pipe(usemin({
			path:'src/',
			html:[minifyHtml({empty:true})],
			css:[less(),minifyCss({keepSpecialComments:0}),'concat'],
			js:[wrap('(function(){\n<%=contents%>\n}())'),uglify()],
		}))
		.pipe(gulp.dest('dist/'));
});
